package com.wut.core.config;

import lombok.Data;
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置文件加密配置类
 */
@Data
@Configuration
public class JasyptConfig {

    @Value("${wut.jasypt.encryptor.password:fT587GDWlVE63dfP}")
    private String password;

    /**
     * 配置文件加解密
     */
    @Bean
    public StandardPBEStringEncryptor jasyptStringEncryptor() {
        StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
        encryptor.setPassword(password);
        return encryptor;
    }
}
